import {
  get,
  post
} from '@/utils/http'


// 验证当前的角色名称是否存在
// Promise<boolean>
export const checkRoleExistsApi = async name => {
  let ret = await post('/api/checkRoleNameExists', {
    name
  })
  if (ret.code == 0) {
    return ret.data
  }
  return false
}

export const addRoleApi = roleData => post('api/roles', roleData)

export const getRolesApi = (page = 1) => get('api/roles?page=' + page)


export const doSearchUserApi = username => post('api/doSearchUser', {
  username
})